# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-orafce
_pkgname=orafce
pkgver=3.21.1
_pkgver=VERSION_${pkgver//./_}
pkgrel=0
pkgdesc="Oracle's compatibility functions and packages for PostgreSQL"
url="https://github.com/orafce/orafce"
arch="all"
license="0BSD"
makedepends="bison flex postgresql-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/orafce/$_pkgname/archive/$_pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$_pkgver"
options="!check"  # XXX: installcheck requires running PostgreSQL

build() {
	make USE_PGXS=1 all
}

package() {
	_pgver=$(pg_config --major-version)
	depends="postgresql$_pgver"

	make USE_PGXS=1 DESTDIR="$pkgdir" install

	cd "$pkgdir"
	mv ./usr/share/doc/postgresql$_pgver/extension \
		./usr/share/doc/$pkgname
	rmdir ./usr/share/doc/postgresql$_pgver
}

sha512sums="
ad98174fd1280f236dcf6704fc63aa6f32b5ee8b46f47a31097a807a946fa7387d74e33fcd790b0e73a16c0ee197f8cdca0b2da23f64b0d6919c539948bcaa4c  postgresql-orafce-3.21.1.tar.gz
"
